package org.springframework.BeanFactoryPostProcesser;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * 自定义Bean的后置处理器
 */
public class MySelfBeanFactoryPostProcessor implements BeanFactoryPostProcessor {


	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
		System.out.println("自定义Bean的后置处理器,重写postProcessBeanFactory方法");
		// 获取容器中的对象
		BeanDefinition beanDefinition = beanFactory.getBeanDefinition("jmUser");
		beanDefinition.getScope();
		// 修改属性
		beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
	}
}